package com.mmo.cq.game.script;

import com.mmo.cq.game.server.AppMain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wxd.ioc.Ioc;

/**
 * @author: Troy.Chen(無心道, 15388152619)
 * @version: 2023-02-02 16:25
 **/
public class ScriptMain {

    public static void main(String[] args) throws Exception {
        try {
            AppMain.init();
            AppMain.initScript(ScriptMain.class.getClassLoader());
            Ioc.start(true, 1, "传奇", "测试版");
        } catch (Throwable throwable) {
            Logger logger = LoggerFactory.getLogger("root");
            logger.error("启动异常", throwable);
            System.exit(1);
        }
//        {
//            DataCenter dataCenter = Ioc.getBean(DataCenter.class);
//
//            MongoDataHelper mongoDataHelper = Ioc.getBean(MongoDataHelper.class);
////            for (int i = 0; i < 1000000; i++) {
////                User user = new User();
////                user.setUid(dataCenter.getServerSeed().newUid(Server_Seed.Type.User, 6001));
////                user.setAccount(StringUtil.getRandomString(6));
////                user.setName(StringUtil.getRandomString(6));
////                mongoDataHelper.getBatchPool().replace(user);
////            }
//
//            for (int i = 0; i < 10; i++) {
//                MarkTimer markTimer = MarkTimer.build();
//                User user = mongoDataHelper.queryEntity(User.class, 60010000000000005L);
//                System.out.println("查询1：" + user + ", " + markTimer.execTime2String());
//                markTimer.clear();
//                MongoQueryBuilder sqlQueryBuilder = mongoDataHelper.getDataWrapper().queryWrapper();
//                sqlQueryBuilder
//                        .select(User::getUid)
//                        .select(User::getAccount)
//                        .select(User::getName)
//                        .select(User::getLv)
//                        .select(User::getVipLv)
//                        .select(User::getJob)
//                        .select(User::getSex)
//
//                ;
//                sqlQueryBuilder.from(User.class);
//
//                QueryWhere queryWhere = sqlQueryBuilder.newQueryWhere();
//                queryWhere.append(User::getUid, WhereEnum.None, 60010000000000005L);
//                sqlQueryBuilder.where(queryWhere);
//
//                List<UserSnap> query = mongoDataHelper.query(sqlQueryBuilder, UserSnap.class);
//                System.out.println("查询2：" + query.get(0) + ", " + markTimer.execTime2String());
//            }
//
//        }
    }

}
